Skip to content

查询用户授权的实名信息

商户可以根据face_sid查询用户UnionId,调用该接口获取授权的实名信息商户需要先申请权限。

请求参数类型描述
face_sidstring终端设备识别用户成功后返回的凭证
queryobject声明请求的查询参数
info_typestring标识本次请求获取的信息类型
ASK_UNIONID | ASK_REAL_NAME 枚举值之一
appidstring微信分配的公众账号ID
sub_mchidstring微信支付分配的子商户号,服务商模式下必填
sub_appidstring微信分配的子商户公众账号ID
sub_serial_nostring⼦商户证书序列号,服务商模式下请求实名信息必传
php
$instance->v3->facemch->users->_face_sid_->getAsync([
  'face_sid' => 'aabbccdd12345',
  'query' => [
    'info_type'     => 'ASK_UNIONID',
    'appid'         => 'wx2b029c08a6233333',
    'sub_mchid'     => '123456789',
    'sub_appid'     => 'wx2b029c08a6255555',
    'sub_serial_no' => 'wx2b029c08a6255555',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/facemch/users/{face_sid}')->getAsync([
  'face_sid' => 'aabbccdd12345',
  'query' => [
    'info_type'     => 'ASK_UNIONID',
    'appid'         => 'wx2b029c08a6233333',
    'sub_mchid'     => '123456789',
    'sub_appid'     => 'wx2b029c08a6255555',
    'sub_serial_no' => 'wx2b029c08a6255555',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/facemch/users/{face_sid}']->getAsync([
  'face_sid' => 'aabbccdd12345',
  'query' => [
    'info_type'     => 'ASK_UNIONID',
    'appid'         => 'wx2b029c08a6233333',
    'sub_mchid'     => '123456789',
    'sub_appid'     => 'wx2b029c08a6255555',
    'sub_serial_no' => 'wx2b029c08a6255555',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->facemch->users->_face_sid_->get([
  'face_sid' => 'aabbccdd12345',
  'query' => [
    'info_type'     => 'ASK_UNIONID',
    'appid'         => 'wx2b029c08a6233333',
    'sub_mchid'     => '123456789',
    'sub_appid'     => 'wx2b029c08a6255555',
    'sub_serial_no' => 'wx2b029c08a6255555',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/facemch/users/{face_sid}')->get([
  'face_sid' => 'aabbccdd12345',
  'query' => [
    'info_type'     => 'ASK_UNIONID',
    'appid'         => 'wx2b029c08a6233333',
    'sub_mchid'     => '123456789',
    'sub_appid'     => 'wx2b029c08a6255555',
    'sub_serial_no' => 'wx2b029c08a6255555',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/facemch/users/{face_sid}']->get([
  'face_sid' => 'aabbccdd12345',
  'query' => [
    'info_type'     => 'ASK_UNIONID',
    'appid'         => 'wx2b029c08a6233333',
    'sub_mchid'     => '123456789',
    'sub_appid'     => 'wx2b029c08a6255555',
    'sub_serial_no' => 'wx2b029c08a6255555',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
union_idstringUnionID
openidstring用户在商户appid下的唯⼀标识
sub_openidstring用户在⼦商户appid下的唯⼀标识
real_name_infoobject姓名信息
encrypted_real_namestring加密后的姓名信息,商户用API证书私钥解密
credential_typeinteger1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 枚举值之一
encrypted_credential_idstring加密后的身份证号,商户用API证书私钥解密

参阅 官方文档

Published on the GitHub by TheNorthMemory